from django.db import models


# Create your models here.

# 老师类
class Teacher(models.Model):
    JOBTYPE = (('0', '讲师'), ('1', '导员'), ('2', '心理老师'))
    name = models.CharField(max_length=20)
    jobtype = models.CharField(max_length=1, choices=JOBTYPE)
    salary = models.DecimalField(max_digits=8,decimal_places=2)

# 班级类
class Tclass(models.Model):
    clsname = models.CharField(max_length=20)
    stucount = models.IntegerField()  # student
    lecturer = models.ForeignKey(Teacher,on_delete=models.SET_DEFAULT,related_name='lecturer',default='0') # 讲师
    instructor = models.ForeignKey(Teacher,on_delete=models.SET_DEFAULT,default='1') # 导员
    clssno = models.CharField(max_length=10)
    subject = models.CharField(max_length=10)


class gitinfo(models.Model):
    nmae = models.CharField(max_length=20)
    gitaddr = models.CharField(max_length=100)
    classblong = models.ForeignKey(Tclass,on_delete=models.SET_NULL,null=True)


class Student(models.Model):
    SEX = (('0','女性'),('1','男性'))
    stu_name = models.CharField(max_length=20)
    sex = models.CharField(max_length=1,choices=SEX)
    cls = models.ForeignKey(Tclass,on_delete=models.SET_NULL,null=True)
    img_path = models.CharField(max_length=255)
    birthday = models.DateField(null=True)
    birthyear = models.IntegerField(null=True)































